import type { ProColumns } from '@ant-design/pro-table';

export type columnsDataType = {
  startTime: string,
  endTime: string,
  custName: string,
  custNo: string,
  email: string,
  mobile: string,
  disctNo: string,
  openDate: string,
  custStatus: number,
  pageNum: number,
  pageSize: number
};
const columnsData: ProColumns<columnsDataType>[] = [

  // 配置搜索框
  {
    title: '会员名',
    dataIndex: 'custName',
    hideInTable: true,
    fieldProps: {
      maxLength: 20
    },
  },
  {
    title: '会员号',
    dataIndex: 'custNo',
    hideInTable: true,
    fieldProps: {
      maxLength: 20
    },
  },
  {
    title: '会员状态',
    dataIndex: 'status',
    valueType: 'select',
    hideInTable: true,
    valueEnum: {
      0: {
        text: '正常'
      },
      1: {
        text: '冻结'
      },
      2: {
        text: '注销'
      },
      3: {
        text: '未激活'
      },
    },
  },
  {
    title: '注册日期',
    dataIndex: 'registerDate',
    valueType: 'dateRange',
    colSize: 1,
    hideInTable: true,
    search: {
      transform: (value) => {
        return {
          startDate: value[0],
          endDate: value[1],
        };
      },
    },
  },

  // table里面的内容
  {
    title: '序号',
    fixed: 'left',
    dataIndex: 'order',
    valueType: 'indexBorder',
    width: 50,
    hideInSearch: true,
  },
  {
    title: '会员名',
    fixed: 'left',
    dataIndex: 'custName',
    hideInSearch: true,
    width: 160,
  },
  {
    title: '会员号',
    dataIndex: 'custNo',
    hideInSearch: true,
    width: 160,
  },
  {
    title: '邮箱',
    dataIndex: 'email',
    hideInSearch: true,
    width: 160,
  },
  {
    title: '电话',
    dataIndex: 'mobile',
    hideInSearch: true,
    width: 120,
  },
  {
    title: '注册日期',
    dataIndex: 'openDate',
    valueType: 'dateTime',
    hideInSearch: true,
    width: 160,
  },
  {
    title: '会员状态',
    width: 100,
    hideInSearch: true,
    dataIndex: 'custStatus',
    valueType: 'select',
    valueEnum: {
      0: {
        text: '正常',
        status: 'Success',
      },
      1: {
        text: '冻结',
        status: 'Error',
      },
      2: {
        text: '注销',
        status: 'Default',
      },
      3: {
        text: '未激活',
        status: 'Default',
      },
    },
  },
  {
    title: '操作',
    hideInSearch: true,
    dataIndex: 'action',
    width: 100,
    fixed: 'right',
  },
];

export default columnsData;